package cao.oschina.bean;

import java.lang.reflect.Field;

/**
 * bean
 * <p/>
 * Created by Haidy on 15/4/13.
 */
public abstract class Bean {

    @Override
    public String toString() {
        Class c = this.getClass();
        Field[] fields = c.getDeclaredFields();
        String str = "";
        for (Field field : fields) {
            field.setAccessible(true);
            try {
                str += field.getName() + "：" + field.get(this) + "\n";
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return str;
    }
}
